package com.bpf.base.security;

import java.io.IOException;
import java.util.Date;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;

import com.bpf.base.common.Constants;
import com.bpf.base.model.system.OperateLog;
import com.bpf.base.service.system.OperateLogService;
import com.bpf.base.util.SpringSecurityUtil;

public class CustomAuthenticationFailureHandler extends SimpleUrlAuthenticationFailureHandler {

	@Autowired
	private OperateLogService operateLogService;

	public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException {
		request.getSession().setAttribute("logerErrTxt", "用户名或密码不正确");
		super.onAuthenticationFailure(request, response, exception);
	}
}
